<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>
	<title>祖龙娱乐  - BI系统</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../../js/highcharts.js"></script>
	<script type="text/javascript" src="../../js/drawChart.js"></script>
</h:head>

<h:body>
	<ui:param name="bean" value="#{mallStatisticsAction}" />
	
	<span class="pagetitle">游戏内分析 —— 商城统计</span>
	<p:separator />
	
	<!-- 右侧页面顶部查询部分 -->
	<h:form id="fsearch">
		<p:growl id="growl" showDetail="true" sticky="true" />
        <p:dataTable id="dlist0" value="#{bean}" scrollable="true" resizableColumns="true" paginator="false" style="text-align:center;">
	        <p:column headerText="开始日期" styleClass="column" style="width:160px">
					<p:calendar value="#{bean.dateStart}" mode="popup" pattern="yyyy-MM-dd">
						<p:ajax event="dateSelect" update="rolelevel dlist0" listener="#{bean.updateRolelevel()}" />
					</p:calendar>	
			</p:column>
			<p:column headerText="结束日期" styleClass="column" style="width:160px">
				<p:calendar value="#{bean.dateEnd}" mode="popup" pattern="yyyy-MM-dd">
					<p:ajax event="dateSelect" update="rolelevel dlist0" listener="#{bean.updateRolelevel()}" />
				</p:calendar>	
			</p:column>
			<p:column headerText="平台" styleClass="column" style="width:60px" rendered="false">
				<p:selectOneMenu id="platformSel" styleClass="queryPlatform" value="#{bean.queryPlatform}">
			        <f:selectItems value="#{bean.platformItmes}" />
			        <p:ajax update="channelSel serverSel" listener="#{bean.updateChannelItmes}" />
		        </p:selectOneMenu>
			</p:column>
			<p:column headerText="渠道" styleClass="column" style="width:70px" rendered="false">
				<p:selectOneMenu id="channelSel" styleClass="queryChannel" value="#{bean.queryChannel}">
			        <f:selectItems value="#{bean.channelItmes}" />
			        <p:ajax update="serverSel platformSel" listener="#{bean.updateServerItmes}" />
		        </p:selectOneMenu>
			</p:column>
			<p:column headerText="区服" styleClass="column" style="width:110px" >
				<p:selectOneMenu id="serverSel" styleClass="queryServer" value="#{bean.queryServer}">
			         <f:selectItems value="#{bean.serverItmes}" />
			         <p:ajax update="channelSel platformSel" listener="#{bean.selectedServer}" />
		        </p:selectOneMenu>
			</p:column>
        	<p:column headerText="物品ID" styleClass="column" style="width:120px">
				<h:inputText value="#{bean.param}"  style="width:94%"/>
			</p:column>
			<p:column id="reason" headerText="商城名称" style="width:120px">
		        <p:selectOneMenu id="reasonSel" styleClass="queryServer" value="#{bean.reason}">
			         <f:selectItems value="#{bean.reasonItmes}" />
		        </p:selectOneMenu>
	        </p:column>
			<p:column id="rolelevel" headerText="角色等级" style="width:120px">
		        <p:selectOneMenu id="rolelevelSel" styleClass="queryServer" value="#{bean.rolelevel}">
			         <f:selectItems value="#{bean.rolelevelMap}" />
		        </p:selectOneMenu>
	        </p:column>
			<p:column headerText="操作" style="width:50px">
        		<p:commandButton value="查询" action="#{bean.search()}" update=":data" ajax="false" />
        	</p:column>
        </p:dataTable>
	</h:form>
	<br />

	<!-- 数据展示部分，包含表格和图表 -->
	<h:form id="dform">
		<h:panelGrid columns="1" style="width:100%">
            <div id="basewidth" style="width:92%;height:0;border:0;">
			</div>
         </h:panelGrid>
	
		<div class="data" id="data">
    		<p:panel id="panel" header="查询结果">
				<p:dataTable id="dlist1" var="l" value="#{bean.dataList1}" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="30">
					<f:facet name="{Exporters}">
						<h:commandLink styleClass="exporter">
					        <p:graphicImage url="/resources/images/excel.png" height="25px"/>
					        <p:dataExporter type="xls" target="dlist1" fileName="activePlayerData-#{pageHelper.getNewDateDetailStr()}"/>
					    </h:commandLink>
					</f:facet>
					
					<p:column headerText="日期" styleClass="column" style="width:80px">
						<h:outputLabel value="#{l.day}"/>
					</p:column>
					<p:column headerText="货币类型" styleClass="column" style="width:80px">
						<h:outputLabel value="#{bean.getMallCurrencytype(l.currencytype)}(#{l.currencytype})"/>
					</p:column>
					<p:column headerText="商城名称" styleClass="column" style="width:80px">
						<h:outputLabel value="#{bean.getMallName(l.param)}"/>
					</p:column>
					<p:column headerText="等级" styleClass="column" style="width:80px">
						<h:outputLabel value="#{bean.getLevelName(l.rolelevel)}"/>
					</p:column>
					<p:column headerText="物品" styleClass="column" style="width:110px">
						<h:outputLabel value="#{bean.getItemType(l.param)}(#{l.param})"/>
					</p:column>
					<p:column headerText="货币消耗量" styleClass="column" style="width:80px">
						<h:outputLabel value="#{bean.getSumchangenum(l.sumchangenum)}"/>
					</p:column>
					<p:column headerText="购买次数" styleClass="column" style="width:80px">
						<h:outputLabel value="#{l.times}"/>
					</p:column>
					<p:column headerText="购买角色数" styleClass="column" style="width:80px">
						<h:outputLabel value="#{l.rolenum}"/>
					</p:column>
					<p:column headerText="货币消耗占比" styleClass="column" style="width:70px">
						<h:outputLabel value="#{bean.getYuanBaoProportion(l.sumchangenum,l.allSumchangenum)}"/>
					</p:column>
					<p:column headerText="角色占比" styleClass="column" style="width:70px">
						<h:outputLabel value="#{bean.getRoleProportion(l.rolenum,l.allRolenum)}"/>
					</p:column>
				</p:dataTable>
    		</p:panel>
		</div>
	</h:form>

	<!-- 页脚 -->
	<div class="footer"></div>
</h:body>
</html>